package com.itheima.Interface3Demo;

public class ClassDateinter2 implements ClassStudents {
    Student[] students;
    public ClassDateinter2(Student[] students) {
        this.students = students;
    }
    @Override
    public void printAllStudents() {
        System.out.println("打印所有学生信息");
        int sum = 0;
        for (Student s : students) {
            if(s.getGender()=="男")
                sum++;
        }
        System.out.println("男生数量："+sum);
        //最高分最低分
        double max = students[0].getScore();
        double min = students[0].getScore();
        for (Student s : students) {
            if(s.getScore()>max)
                max = s.getScore();
            if(s.getScore()<min)
                min = s.getScore();
        }
        System.out.println("最高分："+max);
        System.out.println("最低分："+min);
    }

    @Override
    public void printAverageGrade() {
        System.out.println("打印所有学生的平均成绩");
    }
}
